home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / hplip / ui4 / linefeedcaldialog.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-10-28  |  4KB  |  88 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import operator
  5. from base.g import *
  6. from base import device, utils, maint
  7. from base.codes import *
  8. from ui_utils import *
  9. from PyQt4.QtCore import *
  10. from PyQt4.QtGui import *
  11. from linefeedcaldialog_base import Ui_Dialog
  12. from deviceuricombobox import DEVICEURICOMBOBOX_TYPE_FAX_ONLY
  13.  
  14. class LineFeedCalDialog(QDialog, Ui_Dialog):
  15.     
  16.     def __init__(self, parent, device_uri):
  17.         QDialog.__init__(self, parent)
  18.         self.setupUi(self)
  19.         self.device_uri = device_uri
  20.         self.initUi()
  21.         QTimer.singleShot(0, self.updateUi)
  22.  
  23.     
  24.     def initUi(self):
  25.         self.connect(self.CancelButton, SIGNAL('clicked()'), self.CancelButton_clicked)
  26.         self.connect(self.CalibrateButton, SIGNAL('clicked()'), self.CalibrateButton_clicked)
  27.         self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_noDevices'), self.DeviceUriComboBox_noDevices)
  28.         self.connect(self.DeviceComboBox, SIGNAL('DeviceUriComboBox_currentChanged'), self.DeviceUriComboBox_currentChanged)
  29.         self.DeviceComboBox.setFilter({
  30.             'linefeed-cal-type': (operator.gt, 0) })
  31.         self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
  32.         if self.device_uri:
  33.             self.DeviceComboBox.setInitialDevice(self.device_uri)
  34.         
  35.  
  36.     
  37.     def updateUi(self):
  38.         self.DeviceComboBox.updateUi()
  39.         self.LoadPaper.setButtonName(self._LineFeedCalDialog__tr('Calibrate'))
  40.         self.LoadPaper.updateUi()
  41.  
  42.     
  43.     def DeviceUriComboBox_currentChanged(self, device_uri):
  44.         self.device_uri = device_uri
  45.  
  46.     
  47.     def DeviceUriComboBox_noDevices(self):
  48.         FailureUI(self, self._LineFeedCalDialog__tr('<b>No devices that support line feed calibration found.</b><p>Click <i>OK</i> to exit.</p>'))
  49.         self.close()
  50.  
  51.     
  52.     def CancelButton_clicked(self):
  53.         self.close()
  54.  
  55.     
  56.     def CalibrateButton_clicked(self):
  57.         d = None
  58.         
  59.         try:
  60.             d = device.Device(self.device_uri)
  61.         except Error:
  62.             CheckDeviceUI(self)
  63.             return None
  64.         else:
  65.             linefeed_type = d.linefeed_cal_type
  66.             
  67.             try:
  68.                 d.open()
  69.             except Error:
  70.                 CheckDeviceUI(self)
  71.  
  72.             if d.isIdleAndNoError():
  73.                 if linefeed_type == LINEFEED_CAL_TYPE_OJ_K550:
  74.                     maint.linefeedCalType1(d, (lambda : True))
  75.                 elif linefeed_type == LINEFEED_CAL_TYPE_OJ_PRO_L7XXX:
  76.                     maint.linefeedCalType2(d, (lambda : True))
  77.                 
  78.             else:
  79.                 CheckDeviceUI(self)
  80.  
  81.         self.close()
  82.  
  83.     
  84.     def __tr(self, s, c = None):
  85.         return qApp.translate('LineFeedCalDialog', s, c)
  86.  
  87.  
  88.